/* Vlcmm plugin */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "help.hh"

#include <gtkmm/stock.h>
#include <gtkmm/textbuffer.h>
#include <gtkmm/textview.h>
#include <gtkmm/scrolledwindow.h>

#include <vlc/vlc.h>
#include <vlc_about.h>
#include <vlc_intf_strings.h>

#include "util/string.hh"

HelpDialog::HelpDialog (Gtk::Window *parent)
{

  if (parent)
    set_transient_for (*parent);

  set_title (_("Help"));
  set_has_separator (false);
  set_border_width (2);

  // - - - - - -

  Glib::RefPtr<Gtk::TextBuffer> text_buffer = Gtk::TextBuffer::create ();

  Gtk::ScrolledWindow *scrolled_window = new Gtk::ScrolledWindow ();
  scrolled_window->set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
  scrolled_window->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);

  Gtk::TextView *text_view = new Gtk::TextView ();
  text_view->set_editable (false);
  text_view->set_size_request (520, 300);

  text_buffer->set_text (I_LONGHELP);

  /* FIXME : add html parser/browser on textview */

  text_view->set_buffer (text_buffer);

  scrolled_window->add (*Gtk::manage (text_view));

  get_vbox ()->pack_start (*Gtk::manage (scrolled_window));

  // - - - - - -

  add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL)->signal_clicked ().connect (sigc::mem_fun (this, &HelpDialog::close));

  // - - - - - -

  show_all ();

}

HelpDialog::~HelpDialog ()
{}

void
HelpDialog::close ()
{

  delete this;

}

